package com.cyber.controller;


import com.cyber.entity.Machine;
import com.cyber.service.IMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gmj
 * @since 2022-02-27
 */
@RestController
@RequestMapping("/machine")
public class MachineController {
    @Autowired
    private IMachineService ms;
    @GetMapping("/selectAll")
    public List<Machine> selectAll(){
        return ms.list();
    }

    @PostMapping("/add")
    public void add(@RequestBody Machine machine){
        ms.save(machine);
    }
    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable("id") int id){
        ms.removeById(id);
    }
}

